package com.IODemo;

import java.io.*;

/**
 * @Author milian
 * @Date 2021/7/28 0028 9:51
 */
public class transformStream {
    public static void main(String[] args) throws IOException {
//        解决中文乱码
        OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("H:\\test\\test.txt"));
        osw.write("中国加油");
        osw.close();
         InputStreamReader isr = new InputStreamReader(new FileInputStream("H:\\test\\test.txt"),"gbk");
         int ch;
         while ((ch=isr.read())!=-1){
             System.out.println((char)ch);
         }
         isr.close();
    }
}
